package com.tim.helper.inactive.jmeter;//package com.example.helper.jmeter;
//
//import java.io.File;
//import java.io.IOException;
//import java.lang.annotation.Annotation;
//import java.lang.reflect.InvocationTargetException;
//import java.lang.reflect.Method;
//import java.lang.reflect.Modifier;
//import java.nio.file.Files;
//import java.nio.file.Paths;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Map.Entry;
//import java.util.Objects;
//import java.util.regex.Pattern;
//import java.util.stream.Collectors;
//
//import org.apache.commons.codec.Charsets;
//import org.apache.commons.lang3.StringUtils;
//import org.junit.Test;
//import org.springframework.util.AntPathMatcher;
//import org.springframework.util.ObjectUtils;
//import org.springframework.util.PathMatcher;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//
//import com.alibaba.csp.sentinel.util.StringUtil;
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.born.controller.api.institution.InstitutionApiController;
//import com.born.controller.api.responsibility.WorkResponsibilityApiController;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import lombok.Data;
//import lombok.extern.slf4j.Slf4j;
//
///**
// * @author Adminis
// * @date 2020年8月7日
// * DESC: 基于反射构建jmeter测试
// */
//@Slf4j
//public class GenJmeterThreadGroups2 {
//	//按类修改
//	static Class<?> clazz = InstitutionApiController.class;
//	static String urlPreReal = "/web/institution/";//原控制器前缀，最后为/
//	//选择修改
//	int showContent = 1;//0不输出，1输出结果
//	static int form2Body = 1;//0不变，1请求参数由form变为json
//	static String dir = "C:/Users/Adminis/Desktop/start/req/";//csv、har文件目录
//	static String path = "D:/workSoftware/apache-jmeter-5.2.1/qft测试计划/qft测试计划.jmx";//jmx文件路径
//	//不改
//	static String urlPre = String.format("${%1$s}/", clazz.getSimpleName().replace("Controller", ""));//jmeter控制器变量
//	List<Class<? extends Annotation>> list = Arrays.asList(RequestMapping.class, PostMapping.class,
//			GetMapping.class, DeleteMapping.class, PutMapping.class);
//	
//	public static void main(String[] args) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
//		new GenJmeterThreadGroups2().genThreadGroups();
////		String path = clazz.getSimpleName();
////		String dir = "C:/Users/Adminis/Desktop/start/req/";
////		String csv = dir+path+".csv";
////		new GenJmeterThreadGroups2().getCsvArgList(csv);
//	}
//	@Test
//	public void genThreadGroups() throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
//		Api api = clazz.getDeclaredAnnotation(Api.class);
//		String TEST_NAME = api.tags()[0];
//		RequestMapping mapping = clazz.getDeclaredAnnotation(RequestMapping.class);
//		String globalArg = JmeterElement.GLOBAL_ARG.replace("ARG_NAME", urlPre.substring(2, urlPre.length()-2))
//				.replace("ARG_VAL", mapping==null ? "NULL" : mapping.value()[0]);
//		//反射获取方法注解，jmeter测试
//		Method[] mtds = clazz.getMethods();
//		List<String> mtdList = new ArrayList<>();
//		List<String> urlList = new ArrayList<>();
//		List<String> nameList = new ArrayList<>();
//		List<List<String>> paramsList = new ArrayList<>();
//		//注解无继承，逐一获取判定。参考spring获取url
//		for (int i = 0; i < mtds.length; i++) {
// 			Method method = mtds[i];
//			if (method.getModifiers() == Modifier.PUBLIC) {
//				Annotation req = getMtdAndUrl(mtdList, urlList, method, urlPre);
//				if(req==null) {
//					continue;
//				}
//				ApiOperation mtdApi = method.getDeclaredAnnotation(ApiOperation.class);
//				String name = "";
//				if(mtdApi!=null) {
//					name = mtdApi.value();
//				}
//				nameList.add(name);
//				ApiImplicitParams apiParams = method.getDeclaredAnnotation(ApiImplicitParams.class);
//				List<String> list = new ArrayList<>();
//				if(apiParams!=null) {
//					ApiImplicitParam[] params = apiParams.value();
//					if(!ObjectUtils.isEmpty(params)) {
//						for (int j = 0; j < params.length; j++) {
//							ApiImplicitParam apiImplicitParam = params[j];
//							list.add(apiImplicitParam.name());
//						}
//					}
//				}
//				paramsList.add(list);
//			}
//		}		
//		
//		StringBuilder builder = genTestItem(mtdList, urlList, nameList, paramsList);
//		String threadGroupContent = JmeterElement.THREAD_GROUP.replace("THREAD_GROUP_NAME", TEST_NAME).replace("HTTP_REQ_TEST", builder.toString());
////		System.out.println(threadGroupContent);
//	
//		//追加写到jmeter的文件中
//		write2File(threadGroupContent, globalArg);
//	}
//	//获取请求方法，请求url
//	private Annotation getMtdAndUrl(List<String> mtdList, List<String> urlList, Method method, String urlPre)
//			throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
//		//请求注解，获取请求方法、url
//		Annotation req = null;
//		for (int j = 0; j < list.size(); j++) {
//			Class<? extends Annotation> clz = list.get(j);
//			req = method.getAnnotation(clz);
//			if (req != null) {
//				String url = "";
//				Class<? extends Annotation> reqType = req.annotationType();
//				String mtdName = "";
//				if(reqType.equals(RequestMapping.class)) {
//					Method m = reqType.getMethod("method");
//					Object obj = m.invoke(req);
//					if(!ObjectUtils.isEmpty(obj)) {
//						RequestMethod rMtds = ((RequestMethod[])obj)[0];
//						mtdName = rMtds.name();
//					}else {
//						mtdName = "GET";
//					}							
//				}else {
//					mtdName = reqType.getSimpleName().replace("Mapping", "");
//				}
//				mtdList.add(mtdName.toUpperCase());
//				Method mtd = reqType.getMethod("value");
//				Object obj = mtd.invoke(req);
//				if(!ObjectUtils.isEmpty(obj)) {
//					url = ((String[])obj)[0];
//					url = url.startsWith("/") ? url.substring(1) : url;
//				}
//				urlList.add(urlPre+url);
//				break;
//			}
//		}
//		return req;
//	}
//	//生成测试信息
//	private StringBuilder genTestItem(List<String> mtdList, List<String> urlList, List<String> nameList, List<List<String>> paramsList) throws IOException {
//		if(urlList.isEmpty() || urlList.size()!=nameList.size()) {
//			throw new RuntimeException("urlList is null；或者两者数量不等");
//		}
//		StringBuilder result = new CsvJmeterGenerator().genItem(mtdList, urlList, nameList, paramsList);
//		return result!=null ? result : new CommonJmeterGenerator().genItem(mtdList, urlList, nameList, paramsList);
//	}
//	
//	//写入jmx文件
//	private void write2File(String threadGroupContent, String globalArg) throws IOException {
//		if(showContent==1) {
//			System.out.println(globalArg);
//			System.out.println(threadGroupContent);
//		}
//		List<String> lines = Files.readAllLines(Paths.get(path))
//				.stream()
//				.filter(StringUtils::isNotBlank)
//				.collect(Collectors.toList());
//		int index = 0;
//		for (int i = 0; i < lines.size(); i++) {
//			String str = lines.get(i);
//			if(str.trim().equals("</collectionProp>")) {
//				index = i;
//				break;
//			}
//		}
//		
//		lines.add(index, globalArg);
//		lines.add(lines.size()-3, threadGroupContent);
////			System.out.println(lines);
//		Files.write(Paths.get(path), lines);
//		System.out.println("ok");
//	}
//	@Test
//	public void testMatcher() {
//		Pattern pattern = Pattern.compile("^@[a-zA-Z]{3,8}Mapping");
//		System.out.println(pattern.matcher(	"@GetMapping(value = \"/toList\")").find());
//		System.out.println(String.format("${%1$s}/", clazz.getSimpleName().replace("Controller", ""))	);
//		String realUrl = "/web/task/getsendContent/292";
//		System.out.println(urlPre+realUrl.substring(urlPreReal.length()));
//		
//	}
//	@Test
//	public void testAnnotationGetter() throws NoSuchMethodException, SecurityException, ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
//		Class<WorkResponsibilityApiController> clazz = WorkResponsibilityApiController.class;
//		Method del = clazz.getDeclaredMethod("deleteWorkResponsibility", Long.class);
//		this.getClass().getClassLoader().loadClass("org.springframework.web.bind.annotation.RequestMapping");
//		PostMapping reqs = del.getAnnotation(PostMapping.class);
//		System.out.println(reqs==null);
//		Method m = reqs.annotationType().getMethod("value");
//		Object obj = m.invoke(reqs);
//		System.out.println(m.invoke(reqs));
//		System.out.println(reqs.annotationType().getCanonicalName());
//		System.out.println(reqs.annotationType().getName());
//		System.out.println(reqs.annotationType().getSimpleName());
//		System.out.println(reqs.annotationType().getTypeName());
//	}
//	
//	public static interface JmeterGenerator{
//		StringBuilder genItem(List<String> mtdList, List<String> urlList, List<String> nameList,
//				List<List<String>> paramsList);
//	}
//	
//	/**
//	 * 无csv、har文件；默认构建
//	 * @author Litianlin
//	 * @date 2020年8月20日
//	 *
//	 */
//	public static class CommonJmeterGenerator implements JmeterGenerator{
//		@Override
//		public StringBuilder genItem(List<String> mtdList, List<String> urlList, List<String> nameList,
//				List<List<String>> paramsList) {
//			StringBuilder builder = new StringBuilder();
//			for (int i = 0; i < nameList.size(); i++) {
//				String name = nameList.get(i);
//				String mtd = mtdList.get(i);
//				String url = urlList.get(i);
//				StringBuilder argBuilder = new StringBuilder();
//				List<String> params = paramsList.get(i);
//				if(!ObjectUtils.isEmpty(params)) {
//					for (int j = 0; j < params.size(); j++) {
//						String param = params.get(j);
//						argBuilder.append(JmeterElement.ARG.replace("ARG_NAME", param).replace("ARG_VAL", ""));
//					}
//				}
//				builder.append(JmeterElement.REQ.replace("TEST_NAME", name)
//						.replace("MTD_NAME", mtd).replace("REQ_PATH", url).replace("MTD_ARGS", argBuilder.toString()));
//			}
//			return builder;
//		}
//	}
//	
//	/**
//	 * 如果har、csv文件存在；则构建带参数的测试
//	 * @author Litianlin
//	 * @date 2020年8月20日
//	 *
//	 */
//	public static class CsvJmeterGenerator implements JmeterGenerator{
//
//		@Override
//		public StringBuilder genItem(List<String> mtdList, List<String> urlList, List<String> nameList,
//				List<List<String>> paramsList) {
//			String path = clazz.getSimpleName();
//			String csv = dir+path+".csv";
//			File csvFile = new File(csv);
//			try {
//				if(csvFile.exists()) {
//					return doGenItemWithCsv(mtdList, urlList, nameList, paramsList, csv);
//				}
//				String har = dir+path+".har";
//				File harFile = new File(har);
//				if(harFile.exists()) {
//					new GenJmeterArgs().genArgs(path);//构建csv，调用
//					return doGenItemWithCsv(mtdList, urlList, nameList, paramsList, csv);
//				}
//			} catch (Exception e) {
//				log.error("CsvJmeterGenerator.genItem error,{}", e);
//			}
//			return null;
//		}
//		//按csv生成测试信息
//		private StringBuilder doGenItemWithCsv(List<String> mtdList, List<String> urlList, List<String> nameList,
//				List<List<String>> paramsList, String csv) throws IOException {
//			Map<String, JmeterCsvArg> map = getCsvArgList(csv);
//			StringBuilder builder = new StringBuilder();
//			for (int i = 0; i < nameList.size(); i++) {
//				String name = nameList.get(i);
//				String mtd = mtdList.get(i);
//				String url = urlList.get(i);
//				JmeterCsvArg csvArg = getArg(url, map);
//				StringBuilder argBuilder = new StringBuilder();
//				List<String> params = paramsList.get(i);
//				String body = csvArg!=null ? csvArg.getBody() : "";
//				//form模式时，附加form参数
//				if(form2Body==0 && StringUtil.isNotBlank(body) && !JSON.isValid(body)) {
//					String[] strs = body.split("[=&]");
//					int len = strs.length;
//					for (int j = 0; j < len; j++) {
//						String string = strs[j];
//						argBuilder.append(JmeterElement.ARG.replace("ARG_NAME", string)
//								.replace("ARG_VAL", ++j<len ? strs[j] : ""));
//					}
//				}
//				//处理path参数
//				String[] tempStrs = url.split("/\\{");
//				if(tempStrs.length>1) {
//					for (int j = 1; j < tempStrs.length; j++) {
//						String string = tempStrs[j];
//						string = string.substring(0, string.indexOf('}'));
//						params.remove(string);
//					}
//					String realUrl = csvArg!=null ? csvArg.getUrl() : "";
//	 				if(!ObjectUtils.isEmpty(realUrl)) {
//						url = urlPre+realUrl.substring(urlPreReal.length());
//					}
//				}
//				Map<String, String> query = csvArg==null ? new HashMap<>() : csvArg.getQuery();
//				
//				if(!ObjectUtils.isEmpty(params)) {
//					for (int j = 0; j < params.size(); j++) {
//						String param = params.get(j);
//						argBuilder.append(JmeterElement.ARG.replace("ARG_NAME", param)
//								.replace("ARG_VAL", Objects.toString(query.get(param),"")));
//					}
//				}
//				String reqTemplate = JmeterElement.REQ;
//				if(StringUtil.isNotBlank(body) && JSON.isValid(body)) {
//					argBuilder.append(JmeterElement.JSON_ARG.replace("ARG_VAL", body));
//					reqTemplate = JmeterElement.JSON_REQ;
//				}
//				if(url.contains("managerInstitutionType")) {
//					System.out.println(reqTemplate.replace("TEST_NAME", name)
//							.replace("MTD_NAME", mtd).replace("REQ_PATH", url).replace("MTD_ARGS", argBuilder.toString()));
//				}
//				builder.append(reqTemplate.replace("TEST_NAME", name)
//						.replace("MTD_NAME", mtd).replace("REQ_PATH", url).replace("MTD_ARGS", argBuilder.toString()));
//			}
////			System.out.println(builder.toString());
//			return builder;
//		}
//		String pattern = ",(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)";
//		//csv文件解析为jmeter对应参数
//		private Map<String, JmeterCsvArg> getCsvArgList(String csv) throws IOException {
//			Map<String, JmeterCsvArg> map = new HashMap<>();
////			Paths.get(csv).toFile().d
//			List<String> list;
//			try {
//				list = Files.readAllLines(Paths.get(csv));
//			} catch (Exception e) {
//				log.error("CsvJmeterGenerator.getCsvArgList error msg:{}", e.getMessage());
//				list = Files.readAllLines(Paths.get(csv), Charsets.toCharset("GBK"));
//				log.info(csv+"编码格式为ANSI，使用GBK读取");
//			}
//			list.set(0, "");//首行为标题，不用
//			list.stream()
//				.filter(StringUtils::isNotBlank)
//				.forEach(item->{
//					String[] strArr = item.trim().split(pattern ,-1); //双引号内的逗号不分割  双引号外的逗号进行分割
//					JmeterCsvArg arg = new JmeterCsvArg();
//					String url = removeCsvFormat(strArr[0]);
//					arg.setUrl(url);
//					String body = removeCsvFormat(strArr[2]);
//					Map<String, String> query = new HashMap<>();
//					if(form2Body==1 && StringUtil.isNotBlank(body) && !JSON.isValid(body)){//原form参数，改为了body参数
//						body = body.trim();
//						body = body.endsWith("&") ? body.substring(0, body.length()) : body;
//						body = body.replaceAll("=", "\":\"")
//								.replaceAll("&", "\",\"");
//						body = "{\""+body+"\"}";
//					}
//					arg.setBody(body.replace("\"", "&quot;"));
//					String queryString = removeCsvFormat(strArr[3]);
//					if(JSON.isValidArray(queryString)) {
////						System.out.println(queryString);
//						JSONArray jArr = JSON.parseArray(queryString);
//						for (int i = 0; i < jArr.size(); i++) {
//							JSONObject jObj = (JSONObject) jArr.get(i);
//							query.put(jObj.getString("name"), jObj.getString("value"));
//						}
//					}
//					arg.setQuery(query);
//					map.put(url, arg);
//				});
//				
//			return map;
//		}
//		//移除csv格式
//		private String removeCsvFormat(String str) {
//			if(StringUtils.isNotBlank(str)) {
////				System.out.println(str);
//				if(str.startsWith("\"") && str.endsWith("\"")) {
//					str = str.substring(1, str.length()-1).trim();//移除首尾引号
//					str = str.replace("\"\"", "\"");//替换双双引号
//				}
//			}
//			return str;
//		}
//		//通过PathMatcher匹配，获取对应jmeter参数
//		private JmeterCsvArg getArg(String url, Map<String, JmeterCsvArg> map) {
//			url = url.replace(urlPre, urlPreReal);
//			if(url.contains("{")) {
//				PathMatcher matcher = new AntPathMatcher();
//				for(Entry<String, JmeterCsvArg> entry : map.entrySet()) {
//					if(matcher.match(url, entry.getKey())) {
//						return entry.getValue();
//					}
//				}
//			}
//			return map.get(url.trim());
//		}
//	}
//	
//	
//	@Data
//	public static class JmeterCsvArg {
//		private String url;
//		private String body;
//		private Map<String, String> query;
//		
//	}
//	
//	public static class JmeterElement {
//		/**线程池*/
//		public static final String THREAD_GROUP ="\n      <ThreadGroup guiclass=\"ThreadGroupGui\" testclass=\"ThreadGroup\" testname=\"THREAD_GROUP_NAME\" enabled=\"true\">\r\n" + 
//				"        <stringProp name=\"ThreadGroup.on_sample_error\">continue</stringProp>\r\n" + 
//				"        <elementProp name=\"ThreadGroup.main_controller\" elementType=\"LoopController\" guiclass=\"LoopControlPanel\" testclass=\"LoopController\" testname=\"循环控制器\" enabled=\"true\">\r\n" + 
//				"          <boolProp name=\"LoopController.continue_forever\">false</boolProp>\r\n" + 
//				"          <stringProp name=\"LoopController.loops\">1</stringProp>\r\n" + 
//				"        </elementProp>\r\n" + 
//				"        <stringProp name=\"ThreadGroup.num_threads\">1</stringProp>\r\n" + 
//				"        <stringProp name=\"ThreadGroup.ramp_time\">1</stringProp>\r\n" + 
//				"        <boolProp name=\"ThreadGroup.scheduler\">false</boolProp>\r\n" + 
//				"        <stringProp name=\"ThreadGroup.duration\"></stringProp>\r\n" + 
//				"        <stringProp name=\"ThreadGroup.delay\"></stringProp>\r\n" + 
//				"        <boolProp name=\"ThreadGroup.same_user_on_next_iteration\">true</boolProp>\r\n" + 
//				"      </ThreadGroup>\r\n" + 
//				"      <hashTree>\r\n"
//				+ "HTTP_REQ_TEST"+
//				"        <ResultCollector guiclass=\"ViewResultsFullVisualizer\" testclass=\"ResultCollector\" testname=\"察看结果树\" enabled=\"true\">\r\n" + 
//				"          <boolProp name=\"ResultCollector.error_logging\">false</boolProp>\r\n" + 
//				"          <objProp>\r\n" + 
//				"            <name>saveConfig</name>\r\n" + 
//				"            <value class=\"SampleSaveConfiguration\">\r\n" + 
//				"              <time>true</time>\r\n" + 
//				"              <latency>true</latency>\r\n" + 
//				"              <timestamp>true</timestamp>\r\n" + 
//				"              <success>true</success>\r\n" + 
//				"              <label>true</label>\r\n" + 
//				"              <code>true</code>\r\n" + 
//				"              <message>true</message>\r\n" + 
//				"              <threadName>true</threadName>\r\n" + 
//				"              <dataType>true</dataType>\r\n" + 
//				"              <encoding>false</encoding>\r\n" + 
//				"              <assertions>true</assertions>\r\n" + 
//				"              <subresults>true</subresults>\r\n" + 
//				"              <responseData>false</responseData>\r\n" + 
//				"              <samplerData>false</samplerData>\r\n" + 
//				"              <xml>false</xml>\r\n" + 
//				"              <fieldNames>true</fieldNames>\r\n" + 
//				"              <responseHeaders>false</responseHeaders>\r\n" + 
//				"              <requestHeaders>false</requestHeaders>\r\n" + 
//				"              <responseDataOnError>false</responseDataOnError>\r\n" + 
//				"              <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>\r\n" + 
//				"              <assertionsResultsToSave>0</assertionsResultsToSave>\r\n" + 
//				"              <bytes>true</bytes>\r\n" + 
//				"              <sentBytes>true</sentBytes>\r\n" + 
//				"              <url>true</url>\r\n" + 
//				"              <threadCounts>true</threadCounts>\r\n" + 
//				"              <idleTime>true</idleTime>\r\n" + 
//				"              <connectTime>true</connectTime>\r\n" + 
//				"            </value>\r\n" + 
//				"          </objProp>\r\n" + 
//				"          <stringProp name=\"filename\"></stringProp>\r\n" + 
//				"        </ResultCollector>\r\n" + 
//				"        <hashTree/>\r\n" + 
//				"        <JSONPathAssertion guiclass=\"JSONPathAssertionGui\" testclass=\"JSONPathAssertion\" testname=\"JSON断言\" enabled=\"true\">\r\n" + 
//				"          <stringProp name=\"TestPlan.comments\">path填路径，$开头，点号连接；勾选assert value；value填期望值</stringProp>\r\n" + 
//				"          <stringProp name=\"JSON_PATH\">$.code</stringProp>\r\n" + 
//				"          <stringProp name=\"EXPECTED_VALUE\">200</stringProp>\r\n" + 
//				"          <boolProp name=\"JSONVALIDATION\">true</boolProp>\r\n" + 
//				"          <boolProp name=\"EXPECT_NULL\">false</boolProp>\r\n" + 
//				"          <boolProp name=\"INVERT\">false</boolProp>\r\n" + 
//				"          <boolProp name=\"ISREGEX\">false</boolProp>\r\n" + 
//				"        </JSONPathAssertion>\r\n" + 
//				"        <hashTree/>\r\n" + 
//				"      </hashTree>";
//		
//		/**普通请求*/
//		public static final String REQ = "        <HTTPSamplerProxy guiclass=\"HttpTestSampleGui\" testclass=\"HTTPSamplerProxy\" testname=\"TEST_NAME\" enabled=\"false\">\r\n" + 
//				"          <elementProp name=\"HTTPsampler.Arguments\" elementType=\"Arguments\" guiclass=\"HTTPArgumentsPanel\" testclass=\"Arguments\" testname=\"用户定义的变量\" enabled=\"true\">\r\n" + 
//				"            <collectionProp name=\"Arguments.arguments\">\r\n" + 
//				"MTD_ARGS"+
//				"            </collectionProp>\n" + 
//				"          </elementProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.domain\">${host}</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.port\">${port}</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.protocol\"></stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.contentEncoding\">utf-8</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.path\">REQ_PATH</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.method\">MTD_NAME</stringProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.follow_redirects\">true</boolProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.auto_redirects\">false</boolProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.use_keepalive\">true</boolProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.DO_MULTIPART_POST\">false</boolProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.embedded_url_re\"></stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.connect_timeout\"></stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.response_timeout\"></stringProp>\r\n" + 
//				"        </HTTPSamplerProxy>\n"+ 
//				"        <hashTree/>\r\n";
//		
//		/**带json body的请求*/
//		public static final String JSON_REQ = "        <HTTPSamplerProxy guiclass=\"HttpTestSampleGui\" testclass=\"HTTPSamplerProxy\" testname=\"TEST_NAME\" enabled=\"false\">\r\n" + 
//				"          <boolProp name=\"HTTPSampler.postBodyRaw\">true</boolProp>\r\n" + 
//				"          <elementProp name=\"HTTPsampler.Arguments\" elementType=\"Arguments\">\r\n" + 
//				"            <collectionProp name=\"Arguments.arguments\">\r\n" + 
//				"MTD_ARGS"+
//				"            </collectionProp>\n" + 
//				"          </elementProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.domain\">${host}</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.port\">${port}</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.protocol\"></stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.contentEncoding\">utf-8</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.path\">REQ_PATH</stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.method\">MTD_NAME</stringProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.follow_redirects\">true</boolProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.auto_redirects\">false</boolProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.use_keepalive\">true</boolProp>\r\n" + 
//				"          <boolProp name=\"HTTPSampler.DO_MULTIPART_POST\">false</boolProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.embedded_url_re\"></stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.connect_timeout\"></stringProp>\r\n" + 
//				"          <stringProp name=\"HTTPSampler.response_timeout\"></stringProp>\r\n" + 
//				"        </HTTPSamplerProxy>\n\r\n" + 
//				"        <hashTree>\r\n" + 
//				"          <HeaderManager guiclass=\"HeaderPanel\" testclass=\"HeaderManager\" testname=\"HTTP信息头管理器\" enabled=\"true\">\r\n" + 
//				"            <collectionProp name=\"HeaderManager.headers\">\r\n" + 
//				"              <elementProp name=\"Content-Type\" elementType=\"Header\">\r\n" + 
//				"                <stringProp name=\"Header.name\">Content-Type</stringProp>\r\n" + 
//				"                <stringProp name=\"Header.value\">application/json;charset=UTF-8</stringProp>\r\n" + 
//				"              </elementProp>\r\n" + 
//				"            </collectionProp>\r\n" + 
//				"          </HeaderManager>\r\n" + 
//				"          <hashTree/>\r\n"+ 
//				"        </hashTree>\r\n";
//		
//		/**query参数*/
//		public static final String ARG = "              <elementProp name=\"ARG_NAME\" elementType=\"HTTPArgument\">\r\n" + 
//				"                <boolProp name=\"HTTPArgument.always_encode\">false</boolProp>\r\n" + 
//				"                <stringProp name=\"Argument.value\">ARG_VAL</stringProp>\r\n" + 
//				"                <stringProp name=\"Argument.metadata\">=</stringProp>\r\n" + 
//				"                <boolProp name=\"HTTPArgument.use_equals\">true</boolProp>\r\n" + 
//				"                <stringProp name=\"Argument.name\">ARG_NAME</stringProp>\r\n" + 
//				"              </elementProp>\r\n";
//		
//		/**json body参数*/
//		public static final String JSON_ARG ="              <elementProp name=\"\" elementType=\"HTTPArgument\">\r\n" + 
//				"                <boolProp name=\"HTTPArgument.always_encode\">false</boolProp>\r\n" + 
//				"                <stringProp name=\"Argument.value\">ARG_VAL</stringProp>\r\n" + 
//				"                <stringProp name=\"Argument.metadata\">=</stringProp>\r\n" + 
//				"              </elementProp>\r\n";
//		
//		/**全局变量*/
//		public static final String GLOBAL_ARG = "          <elementProp name=\"ARG_NAME\" elementType=\"Argument\">\r\n" + 
//				"            <stringProp name=\"Argument.name\">ARG_NAME</stringProp>\r\n" + 
//				"            <stringProp name=\"Argument.value\">ARG_VAL</stringProp>\r\n" + 
//				"            <stringProp name=\"Argument.metadata\">=</stringProp>\r\n" + 
//				"          </elementProp>\r\n";
//
//	}		
//	
//}
